ALTER TABLE `wood_product_history` CHANGE `dimensions_prices` `dimensions_price` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL;

UPDATE wood_product_pricing
SET price = ROUND(price * 10)

ALTER TABLE `wood_product_pricing` CHANGE `price` `price` BIGINT NULL DEFAULT NULL;

ALTER TABLE `wood_product_pricing` CHANGE `weight` `weight` BIGINT NULL DEFAULT NULL;

ALTER TABLE `wood_product` ADD `grain_matchable` INT NOT NULL DEFAULT '0' AFTER `is_not_available`;

ALTER TABLE `wood_product_history` ADD `grain_matchable` INT NOT NULL AFTER `is_not_available`;

CREATE TRIGGER price_update_history
AFTER UPDATE ON wood_product_pricing
FOR EACH ROW
BEGIN
    -- Only log if flag is set
    IF @audit_pricing = 1 THEN
        INSERT INTO wood_product_pricing_history 
        (pricing_id, old_price, new_price, dimensions_id, changed_at)
        VALUES (NEW.id, OLD.price, NEW.price, NEW.dimensions_id, NOW());
    END IF;
END;